package com.bbdjt.weixin.service.impl;

import java.util.List;


import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.util.StringUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.bbdjt.weixin.model.DoctorQueryModel;
import com.bbdjt.weixin.base.service.impl.BaseServiceImpl;
import com.bbdjt.weixin.dao.DoctorDao;
import com.bbdjt.weixin.model.Doctor;
import com.bbdjt.weixin.service.DoctorService;

@Service("doctorService")
public class DoctorServiceImpl extends BaseServiceImpl<Doctor> implements DoctorService {
	
	@Override
    public List<Doctor> selectByDoctor(Doctor doctor, int page, int rows) {
        Example example = new Example(Doctor.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(doctor);
        PageHelper.startPage(page, rows);
        return selectByExample(example);
    }
    
    @Override
    public List<Doctor> selectByDoctor(Doctor doctor) {
        Example example = new Example(Doctor.class);
        Example.Criteria criteria = example.createCriteria();
        criteria.andEqualTo(doctor);
        return selectByExample(example);
    }

    @Override
    public PageInfo<DoctorQueryModel> selectByDoctorQueryModel(DoctorQueryModel doctor) {
    	return ((DoctorDao) getMapper()).selectByDoctorModel(doctor);
    }

	@Override
	public List<Doctor> selectByDoctor(DoctorQueryModel doctor) {
		  Example example = new Example(Doctor.class);
	        Example.Criteria criteria = example.createCriteria();
	        criteria.andEqualTo(doctor);
	        PageHelper.startPage(doctor.getPageNum(), doctor.getPageSize(),doctor.getOrderBy());
	        return selectByExample(example);
	}

	@Override
	public Doctor selectDoctor(Doctor doctor) {
		return ((DoctorDao) getMapper()).selectDoctor(doctor);
	}

	
}